/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.mk.transaction.requesttowarehousedetail;

import com.ronsicecream.pos.out.transaction.requesttowarehousedetail.*;
import com.buanalintas.bynga.Action;
import com.buanalintas.bynga.Field;
import com.buanalintas.bynga.Page;
import com.ronsicecream.pos.entities.PosTransactionOutRequestMaterialToWarehouseDetail;

/**
 *
 * @author user
 */
public class RequestDetail extends Page {

    private Field requestDetailId;
    private Field requestDetailQuantity;
    private Field requestDetailPrice;
    private Field requestDetailDescription;
//    private Field requestDetailSatuanId;
    private Field requestDetailItemId;
    private Field requestDetailRequestId;

    public RequestDetail() {
        super();

        setTheClass(PosTransactionOutRequestMaterialToWarehouseDetail.class);




        requestDetailId = new Field();
        requestDetailId.setName("requestDetailId");
        requestDetailId.setCaption("request detail id");
        //requestDetailId.setInfo("request detail id");
        requestDetailId.setListProperties(" align=\"left\" width=\"1%\" nowrap");
        requestDetailId.setInputProperties(" size=\"20\"");
        getFields().add(requestDetailId);

        requestDetailQuantity = new Field();
        requestDetailQuantity.setName("requestDetailQuantity");
        requestDetailQuantity.setCaption("quantity");
        requestDetailQuantity.setRequired(true);
        requestDetailQuantity.setListProperties(" align=\"left\" width=\"20%\" nowrap");
        requestDetailQuantity.setInputProperties(" size=\"20\"");
        getFields().add(requestDetailQuantity);

        requestDetailPrice = new Field();
        requestDetailPrice.setName("requestDetailPrice");
        requestDetailPrice.setCaption("price");
        requestDetailPrice.setRequired(true);
        requestDetailPrice.setListProperties(" align=\"left\" width=\"20%\" nowrap");
        requestDetailPrice.setInputProperties(" size=\"20\"");
        getFields().add(requestDetailPrice);

        requestDetailDescription = new Field();
        requestDetailDescription.setName("requestDetailDescription");
        requestDetailDescription.setCaption("description");
        //requestDetailDescription.setInfo("request detail description");
        requestDetailDescription.setListProperties(" align=\"left\" width=\"30%\" nowrap");
        requestDetailDescription.setInputProperties(" cols=\"50\" rows=\"5\"");
        requestDetailDescription.setInputType(Field.INPUT_TEXT_AREA);
        requestDetailDescription.setInputCase(Field.CASE_UPPER);
        getFields().add(requestDetailDescription);

//        requestDetailSatuanId = new Field();
//        requestDetailSatuanId.setName("requestDetailSatuanId");
//        requestDetailSatuanId.setCaption("satuan");
//        //posMasterSatuan.setInfo("pos master satuan");
//        requestDetailSatuanId.setListProperties(" align=\"left\" width=\"10%\" nowrap");
//        requestDetailSatuanId.setInputProperties(" size=\"20\"");
//        getFields().add(requestDetailSatuanId);

        requestDetailItemId = new Field();
        requestDetailItemId.setName("requestDetailItemId");
        requestDetailItemId.setCaption("item");
        requestDetailItemId.setSelectorCondition("t.itemTypeId.typeId=6");
        requestDetailItemId.getSelectorAction().add(new String[]{"value", "requestDetailPrice", "itemPriceOutlet"});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemName", " Nama", "width=\"40%\""});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemCode", " Code", "width=\"10%\" nowrap"});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemTypeId", " Type", "width=\"20%\""});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemMinimum", " Minimum", "width=\"10%\""});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemSatuanId", " Satuan", "width=\"10%\""});
        requestDetailItemId.getSelectorColumns().add(new String[]{"itemRasaId", " Rasa", "width=\"10%\""});
        requestDetailItemId.setListProperties(" align=\"left\" width=\"30%\" nowrap");
        requestDetailItemId.setInputProperties(" size=\"20\"");
        getFields().add(requestDetailItemId);

        requestDetailRequestId = new Field();
        requestDetailRequestId.setName("requestDetailRequestId");
        requestDetailRequestId.setCaption("request");
        //posTransactionRequestFromOutlet.setInfo("pos transaction request from outlet");
        requestDetailRequestId.setListProperties(" align=\"left\" ");
        requestDetailRequestId.setInputProperties(" size=\"20\"");
        getFields().add(requestDetailRequestId);


        fillFields();
        getFieldsAdd().clear();
        getFieldsAdd().add(requestDetailItemId);
        getFieldsAdd().add(requestDetailQuantity);
//        getFieldsAdd().add(requestDetailPrice);
        getFieldsAdd().add(requestDetailDescription);

        getFieldsEdit().clear();
        getFieldsEdit().add(requestDetailItemId);
        getFieldsEdit().add(requestDetailQuantity);
//        getFieldsEdit().add(requestDetailPrice);
        getFieldsEdit().add(requestDetailDescription);

        getFieldsList().clear();
        getFieldsList().add(requestDetailItemId);
        getFieldsList().add(requestDetailPrice);
        getFieldsList().add(requestDetailQuantity);
        getFieldsList().add(requestDetailDescription);

        getActions().add(Action.TRANS_DETAIL_LIST);
        getActions().add(Action.TRANS_DETAIL_ADD);
        getActions().add(Action.TRANS_DETAIL_EDIT);
    }
}
